home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / util / cdity / IFX.lha / IFX / AmigaE / input / testinput.e < prev   
Text File  |  1998-01-02  |  864b  |  53 lines

  1. ->
  2. -> testinput.e
  3. ->
  4. -> Test the input handler routines
  5. ->
  6.  
  7. MODULE '*inputhandler'
  8. MODULE 'dos/dos'
  9. MODULE 'devices/inputevent'
  10.     
  11. -> The event counter
  12. DEF inputcount:LONG    
  13.     
  14. ->
  15. PROC main() HANDLE
  16.     DEF ih:PTR TO inputhandler
  17.     
  18.     -> Intilialize input handler
  19.     NEW ih.init({testhandler}, NIL, 10, 'Test')
  20.     
  21.     -> Install it
  22.     ih.install()
  23.     
  24.     -> Wait for a keypress from the CLI
  25.     WriteF('Waiting for CTRL-C...')
  26.     Wait(SIGBREAKF_CTRL_C)
  27.     
  28.     -> Remove handler
  29.     ih.remove()
  30.     
  31.     -> Destroy input handler
  32.     END ih
  33.     
  34.     -> Tell user count
  35.     WriteF('\d\n', inputcount)
  36. EXCEPT
  37.     WriteF('Exception!!! Number = $\h\n', exception)
  38. ENDPROC
  39.  
  40. PROC testhandler(list:PTR TO inputevent)
  41.     DEF class
  42.     class := list.class
  43.     SELECT class
  44.     CASE IECLASS_DISKINSERTED
  45.         DisplayBeep(NIL)
  46.     CASE IECLASS_DISKREMOVED
  47.         DisplayBeep(NIL)
  48.     DEFAULT
  49.         INC inputcount
  50.     ENDSELECT
  51.         
  52.     MOVE.L list, D0
  53. ENDPROC list